InĀ [4]:
import pandas as pd
import numpy as np
import altair as alt
alt.data_transformers.enable("vegafusion")
Out[4]:
DataTransformerRegistry.enable('vegafusion')
Data¶
Local Marginal Price of the Day Ahead Market in CAISO
InĀ [5]:
df = pd.read_csv('data/512pre.csv')
df
Out[5]:
| OPR_DT | NODE | MW | INTERVALSTARTTIME | INTERVALENDTIME | |
|---|---|---|---|---|---|
| 0 | 2025-05-12 | AFPR_1_TOT_GEN-APND | 42.62938 | 2025-05-12 00:00:00 | 2025-05-12 01:00:00 |
| 1 | 2025-05-12 | AFPR_1_TOT_GEN-APND | 40.00993 | 2025-05-12 01:00:00 | 2025-05-12 02:00:00 |
| 2 | 2025-05-12 | AFPR_1_TOT_GEN-APND | 37.27168 | 2025-05-12 02:00:00 | 2025-05-12 03:00:00 |
| 3 | 2025-05-12 | AFPR_1_TOT_GEN-APND | 37.20192 | 2025-05-12 03:00:00 | 2025-05-12 04:00:00 |
| 4 | 2025-05-12 | AFPR_1_TOT_GEN-APND | 39.59306 | 2025-05-12 04:00:00 | 2025-05-12 05:00:00 |
| ... | ... | ... | ... | ... | ... |
| 57475 | 2025-05-12 | YU_6_TGEN-APND | 49.91317 | 2025-05-12 19:00:00 | 2025-05-12 20:00:00 |
| 57476 | 2025-05-12 | YU_6_TGEN-APND | 50.03485 | 2025-05-12 20:00:00 | 2025-05-12 21:00:00 |
| 57477 | 2025-05-12 | YU_6_TGEN-APND | 47.46705 | 2025-05-12 21:00:00 | 2025-05-12 22:00:00 |
| 57478 | 2025-05-12 | YU_6_TGEN-APND | 45.50924 | 2025-05-12 22:00:00 | 2025-05-12 23:00:00 |
| 57479 | 2025-05-12 | YU_6_TGEN-APND | 45.91848 | 2025-05-12 23:00:00 | 2025-05-13 00:00:00 |
57480 rows Ć 5 columns
InĀ [6]:
chart = alt.Chart(df).mark_line().encode(
x='INTERVALSTARTTIME:T',
y='MW:Q',
color='NODE:N', # One line per node
tooltip=['NODE', 'MW']
).properties(
title='Day-Ahead LMP ($/MWh) Over Time by Node',
width=800,
height=400
)
chart.interactive()
Out[6]:
InĀ [7]:
# Step 1: Filter only for AFPR_1_TOT_GEN-APND node
node_df = df[df['NODE'] == 'AFPR_1_TOT_GEN-APND'].copy()
node_df = node_df.sort_values('INTERVALSTARTTIME').reset_index(drop=True)
chart = alt.Chart(node_df).mark_line().encode(
x='INTERVALSTARTTIME:T',
y='MW:Q',
).properties(
title='Day-Ahead LMP ($/MWh) for node- AFPR_1_TOT_GEN-APND',
width=800,
height=400
)
chart
Out[7]: